Exception Handlers in Functional Programming Languages
نویسنده
چکیده
| Constructs for expressing exception handling can greatly help to avoid clutter in code by allowing the programmer to separate the code to handle unusual situations from the code for the normal case. Handling exceptions in functional languages has received less attention mainly due to the inherent connict between the control ow oriented approach of exception handlers and the functional style of evaluation. This has (i) resulted in loss of refer-ential transparency, (ii) made non-strict constructs behave as strict functions, and most importantly, (iii) forced an order of evaluation on the subexpressions in a function. In this paper, we propose a new approach to embed exception handlers in functional languages. The proposed approach discards the conventional view of treating exceptions as a means of eeecting a control transfer; instead, exceptions are used to change the state of an object. The two types of exceptions, Terminate and Resume, are treated diierently in this paper. A Terminate exception, when raised, is viewed as shielding the input object. On the other hand, a Resume exception designates the input object as curable and requires the immediate application of a handler function. This approach enables the clean semantics of functions raising exceptions (1) without associating any implementation restriction and (ii) without loss of the referential transparency and the commutativity properties of functions.
منابع مشابه
Safe Asynchronous Exceptions for Python
We demonstrate that the Python programming language is not signal-safe, due to Python’s support for raising exceptions from signal handlers. We examine the approaches that various languages have used when dealing with the combination of asynchrony and exception handling, and propose a modification of the Python language that restores signal safety.
متن کاملException Handlers as Extensible Cases
Exceptions are an indispensable part of modern programming languages. They are, however, handled poorly, especially by higherorder languages such as Standard ML and Haskell: in both languages a well-typed program can unexpectedly fail due to an uncaught exception. In this paper, we propose a technique for type-safe exception handling. Our approach relies on representing exceptions as sums and a...
متن کاملFrom Theory to Practice of Algebraic Effects and Handlers (Dagstuhl Seminar 16112)
Dagstuhl Seminar 16112 was devoted to research in algebraic effects and handlers, a chapter in the principles of programming languages which addresses computational effects (such as I/O, state, exceptions, nondeterminism, and many others). The speakers and the working groups covered a range of topics, including comparisons between various control mechanisms (handlers vs. delimited control), imp...
متن کاملQuality Time - Can Aspect-Oriented Programming Lead to More Reliable Software?
A spect-oriented programming is a novel topic in the software engineering and languages communities. AOP appears to have the potential to significantly improve the reliability of programs, particularly by modu-larizing error-handling policies and allowing for easier maintenance and better reuse. In this article we introduce AspectJ, the first aspect-oriented programming language, and demonstrat...
متن کاملHotDep ’06: Second Workshop on Hot Topics in System Dependability
S) Summarized by Geoffrey Lefebvre Making Exception Handling Work Bruno Cabral and Paulo Marques, University of Coimbra, Portugal Presented by Bruno Cabrel Exceptions are the standard mechanism for error handling in modern programming languages. Unfortunately, dealing with exceptions is a tedious process. Programmers often avoid the issue by writing empty handlers to save time. Programmers who ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- IEEE Trans. Software Eng.
دوره 19 شماره
صفحات -
تاریخ انتشار 1993